package mmc.action.skill;

import mmc.server.RemoteClient;

public class Portal extends Skill {

	private boolean portal = true;
	private mmc.objects.Portal p1;
	@SuppressWarnings("unused")
	private mmc.objects.Portal p2;
	
	
	public Portal() {
		super("Mark", "mmc/resource/data/portal.png", 0);
		this.needTarget = false;
	}

	@Override
	public void endCast(RemoteClient client) {
		mmc.server.Player player = client.getPlayer();
		
		if(p1 != null)
			client.getServer().getScene().removeObject(p1);
		p1 = new mmc.objects.Portal(player.x,player.y,player.z);
		p1.player = player;
		
		client.getServer().getScene().addObject(p1);
		
		/*
		if(portal)
		{
			if(p1 == null){
				p1 = new mmc.objects.Portal(player.x,player.y,player.z);
				client.getServer().getScene().addObject(p1);
			}
			else{
				
			}
		}
		else{
			if(p2 == null){
				p2 = new mmc.objects.Portal(player.x,player.y,player.z);
				client.getServer().getScene().addObject(p2);
			}
			else{
				client.getServer().getScene().removeObject(p2);
				p2 = new mmc.objects.Portal(player.x,player.y,player.z);
				client.getServer().getScene().addObject(p2);				
			}
		}*/
		
		portal = !portal;
	}
}
